import React from 'react'
import { useState, useRef } from 'react'

export default function Child1({setList}) {
    const inputRef = useRef(null)
    const handler = () => {
        setList((prelist) => [...prelist, inputRef.current.value])
    }
    return (
        <div>
            <div className="hd">
                <input type="text" ref={inputRef} />
                <button onClick={handler}>确认</button>
            </div>
        </div>
    )
}
